package com.yunhe.policyfulfillment.policyful.controller;

import com.yunhe.policyfulfillment.policyful.domain.PolicyApprovalTimeLimit;
import com.yunhe.policyfulfillment.policyful.service.PolicyApprovalTimeLimitService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;

/**
 * 审批时限设置
 * @author 张翔宇
 * @date 2021年11月18日14点01分
 */
@RestController
@RequestMapping("/policyApprovalTimeLimit")
@Api(value = "审批时限设置", tags = {"Model_PolicyApprovalTimeLimit"})
@RequiredArgsConstructor
public class PolicyApprovalTimeLimitController {
    private final PolicyApprovalTimeLimitService service;

    @ApiOperation("查询所以数据")
    @GetMapping("/findAll")
    public ResponseEntity<List<PolicyApprovalTimeLimit>> findAll() {
        return new ResponseEntity(service.findAll(), HttpStatus.OK);
    }

    @ApiOperation("更新数据")
    @PutMapping("/updateById/{id}")
    public ResponseEntity updateById(@RequestBody PolicyApprovalTimeLimit limit, @PathVariable String id ) {
        return new ResponseEntity(service.updateById(limit), HttpStatus.OK);
    }
}
